package com.example.user_manage.exception;

import com.example.user_manage.enums.ExceptionEnum;
import lombok.Getter;

@Getter
public class ServiceException extends RuntimeException {

    /**
     * 错误码
     */
    private final String errorCode;
    /**
     * 异常信息
     */
    private final String message;

    /**
     * 服务层异常
     * @param exceptionEnum 异常枚举
     */
    public ServiceException(ExceptionEnum exceptionEnum) {
        super(exceptionEnum.getMessage());
        this.errorCode = exceptionEnum.getCode();
        this.message = exceptionEnum.getMessage();
    }
}
